﻿'Params
'tag (Required) : The tag name
'api_key (Required) : A Last.fm API key.
'Auth
'This service does not require authentication. 

Public Structure TagGetWeeklyChartListResponse
    Public charts()
    Public to_
    Public from_
End Structure

Public Class TagGetWeeklyChartList
	Inherits BaseRequest
	Dim tag As String

	Public xmlresponse As XDocument = Nothing

	Public Sub New(ByVal tag As String)
		tag = tag
	End Sub

	Public Sub sendRequest()
		ClearMembers()
		InitializeMembers("tag.GetWeeklyChartList")

		AddMember("tag", tag, False)
		AddMember("api_key", My.Settings.api_key, False)

		xmlresponse = sendPOSTResponse()
	End Sub

	Public Function getResponse() As TagGetWeeklyChartListResponse
        Dim response As New TagGetWeeklyChartListResponse
        Dim count As Integer
        Try
            count = xmlresponse.<lfm>.<weeklychartlist>.Count()
        Catch ex As Exception
            Return response
        End Try

        If (count > 0) Then
            ReDim response.charts(count - 1)
            For i As Integer = 0 To count - 1
                response.charts(i) = New Chart(xmlresponse.<lfm>.<weeklychartlist>(i))
            Next
        End If

		Return response
	End Function
End Class
